import React from 'react';
import './App.css';
//配置路由
import {HashRouter as Router,Route,Redirect,Switch} from 'react-router-dom';
import loadable from './util/loadable'
const Openpage = loadable(()=>import('./view/OpenPage'))
const Mytaobao = loadable(()=>import('./view/Mytaobao'))
const Xq = loadable(()=>import('./view/xq'))
const Login = loadable(()=>import('./view/Login'))

function App() {
  return (
    <div className="App">
        <Router>
          <Switch>
              <Route path="/xq/:id" render={()=>{
                return localStorage.getItem('username')?<Xq/>:<Redirect to="/Login"/>}}></Route>
              <Route path="/Login" component={Login}></Route>
              <Route path="/Mytaobao" component={Mytaobao}></Route>
              <Route path="/" component={Openpage}></Route>
          </Switch>
        </Router>
    </div>
  );
}

export default App;
